#include "Timer.h"

Timer::Timer()
{
	m_TicksLastFrame = 0;
	m_DeltaTime = 0;
}

void Timer::Update()
{
	int TicksThisFrame = SDL_GetTicks();

	int diff = TicksThisFrame - m_TicksLastFrame;

	m_DeltaTime = (float)diff / 1000.0f;
	if(m_DeltaTime > 0.25)
	{
		m_DeltaTime	= 0.25f;
	}


	m_TicksLastFrame = TicksThisFrame;
}

float Timer::GetDeltaTime() const
{
	return m_DeltaTime;
}